function bindActionCreator(actionCreator, dispatch) {
  return (...args) => {
    return dispatch(actionCreator.apply(null, args));
  };
}

function bindActionCreators(actionCreators, dispatch) {
  const _bindActionCreators = {};

  for (const key in actionCreators) {
    const actionCreator = actionCreators[key];
    _bindActionCreators[key] = bindActionCreator(actionCreator, dispatch);
  }

  return _bindActionCreators;
}

export default bindActionCreators;
